import httpServe from '@/global-services/index';

/**
 * 小于300MB的文件上传
 * @param data file文件
 * @returns
 */
export const UploadBelow300MBFileAPI = (data: any, axiosCancel: any): any => {
	const newData = new FormData();
	newData.append('file', data);

	return httpServe.postHttp('/fileAction/upload')(newData, { timeout: 120000, signal: axiosCancel.signal });
};

/**
 * 大于300MB的文件上传文件名获取真正的上传url地址
 * @param fileName file文件的名称
 * @returns
 */
export const GetUploadUrlByNameAPI = (fileName: any): any => {
	return httpServe.postHttp('/fileAction/getPresignedObjectUrl')(fileName, { timeout: 120000 });
};
/**
 *
 * @param furlUrl
 * @param file
 * @returns
 */
export const UploadExceed300MBFileAPI = (furlUrl: any, file: any, axiosCancel: any): any => {
	return httpServe.putHttp(furlUrl)(file, { timeout: 120000, signal: axiosCancel.signal });
};

/** 菜单权限类 **/
export const MenusAPI = {
	// 获取初始化的系统全部菜单
	allMenus: (): any => httpServe.getHttp('/system/menus')(),
	// 登录成功后获取角色绑定的菜单
	roleMenus: (): any => httpServe.getHttp('/system/menus-token')()
};

export const commonTaskApi = {
	// 批量导出-任务栏-列表查询
	getExportList: (data: any) => httpServe.getHttp('/base/export/list')(data)
};
